<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="java.util.Date"%>
<%@taglib prefix="sj" uri="/struts2-jquery-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'add_only_model.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script src="Scripts/mfcrm_js.js" type="text/javascript"></script>
	<script src="Scripts/box.js" type="text/javascript"></script>
	<link href="Styles/box.css" rel="stylesheet" type="text/css" />
	<link href="Styles/mfcrm_styles.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript">

                function Year_list() {
                    // var idField = document.getElementById("couponNo");
     
                    var url = "getYearAction";
   
                    if (typeof XMLHttpRequest != "undefined") {
                        req = new XMLHttpRequest();
                    } else if (window.ActiveXObject) {
                        req = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    req.open("GET", url, true);
   
                    req.onreadystatechange = callback_Year;
                    req.send(null);
  
                }

                function callback_Year() {
                    if (req.readyState == 4) {
                        if (req.status == 200) {
                        var name= document.getElementById("year_start");
                        var breakStr=req.responseText;
                        var temp=new Array();
                        temp=  breakStr.split(':');
                        name.options.length = 0; // clear out existing items
                        for(i=0; i <temp.length-1;i++)
                        {
                            var opt = document.createElement('option');
                            opt.text = temp[i];
        
                            try
                            {
                                name.add( opt, null );						
                            }
                            catch(ex)
                            {
                                name.add( opt );		
                            }	
                   
                        }											
        
            
                        }

                    }
                } 
	   function GetMake() {
                    var make = document.getElementById("year_start").value;
     
                    var url = "getMakeAction?make_action="+make;
           
                    if (typeof XMLHttpRequest != "undefined") {
                        req = new XMLHttpRequest();
                    } else if (window.ActiveXObject) {
                        req = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    req.open("GET", url, true);
   
                    req.onreadystatechange = callback_make;
                    req.send(null);
  
                }

                function callback_make() {
                    if (req.readyState == 4) {
                        if (req.status == 200) {
                        var name= document.getElementById("make");
                        var breakStr=req.responseText;
                        var temp=new Array();
                        temp=  breakStr.split(':');
                        name.options.length = 0; // clear out existing items
                        for(i=0; i <temp.length-1;i++)
                        {
                            var opt = document.createElement('option');
                            opt.text = temp[i];
        
                            try
                            {
                                name.add( opt, null );						
                            }
                            catch(ex)
                            {
                                name.add( opt );		
                            }	
                   
                        }											
        
            
                        }

                    }
                }   
                function getModel() {
                    var make = document.getElementById("make").value;
                    var year = document.getElementById("year_start").value;
                    var url = "getModelAction?model_action="+make+"&year_action="+year;
           
                    if (typeof XMLHttpRequest != "undefined") {
                        req = new XMLHttpRequest();
                    } else if (window.ActiveXObject) {
                        req = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    req.open("GET", url, true);
   
                    req.onreadystatechange = callback_model;
                    req.send(null);
  
                }

                function callback_model() {
                    if (req.readyState == 4) {
                        if (req.status == 200) {
                        var name= document.getElementById("model");
                        var breakStr=req.responseText;
                        var temp=new Array();
                        temp=  breakStr.split(':');
                        name.options.length = 0; // clear out existing items
                        for(i=0; i <temp.length-1;i++)
                        {
                            var opt = document.createElement('option');
                            opt.text = temp[i];
        
                            try
                            {
                                name.add( opt, null );						
                            }
                            catch(ex)
                            {
                                name.add( opt );		
                            }	
                   
                        }											
        
            
                        }

                    }
                } 
                 
</script>
</head>
<body onload="Year_list();">
<h2>
  <s:form action="insert_model" method="post" name="stock_data" theme="css_xhtml">
  </s:form>
</h2>
<s:form action="insert_model" method="post" name="stock_data" theme="css_xhtml">
  <table border="0" cellpadding="0" cellspacing="0" align="left" width="100%">
<tbody>
<tr>
<td width="100%" height="38" valign="middle" align="left" bgcolor="#ff7519" >Add New Model Form:</td>
</tr>
			<tr>
				<td >
				<table  class="obox" cellpadding="0" width="100%">
					<tbody>
					<tr>
						       <tr bgcolor="#ffffff">
						        <td nowrap="nowrap" bgcolor="#530053" style="font-family: &#39;Courier New&#39;, Courier, monospace; font-size: small; color: #FFFFFF; font-style: normal; text-transform: capitalize" align="center" colspan="4"></td>
						        <td class="style5" colspan="4" bgcolor="#530053" style="font-family: &#39;Courier New&#39;, Courier, monospace; font-size: small; color: #FFFFFF; font-style: normal; text-transform: capitalize" align="center"></td>
					          </tr>
					          <tr bgcolor="#ffffff">
						         <td class="style1">Car Mfg: <span style="color:Red;font-size:Medium;display:none;">*</span>
                                  </td>
						        <td width="100px">
						          <s:select  list="# {'':'Year'}" name="v_mfgy" id="year_start" onchange="GetMake();" style="width:50px;" tabindex="1"></s:select>
                                  </td>
						        <td class="style1">Make:<span style="color:Red;font-size:Medium;display:none;">*</span>
                                  </td>
                                 <td class="style2">
                                  <s:select  list="# {'':'Select Make'}" name="v_make" id="make" onchange="getModel();" style="width:100px;" tabindex="2"/>
                                 
                                 </td>
                                  
						        <td class="style5">Model:<span style="color:Red;font-size:Medium;display:none;">*</span>
                                  </td>
                                  
						        <td class="style2">
						        
						       <s:select  list="# {'':'Select Model'}" id="model" style="width:100px;" tabindex="3"/>
						        </td>
                              
                                                          
						        <td class="style1">ADD New Model :<span style="color:Red;font-size:Medium;display:none;">*</span>
                                  </td>
                                <td nowrap="nowrap" class="style1">
                                 <input name="v_model"  type="text" tabindex="4"> 
                                </td>
                                
					          </tr>
					          
					          </tbody>
					          </table>
					          </td>
                             </tr>
                             <tr valign="middle">
						       <td class="orgbg" colspan="10" align="center">
                                 <input type="submit" name="Button1" value="CONFIRM"  id="Button1" tabindex="66" class="btn"  onclick="return check_emplty();">
						          &nbsp;
                                  <input type="reset" name="Button2" value="RESET" id="Button2" tabindex="67" class="btn">
                                </td>
					          </tr>
</tbody>
</table>
</s:form>
					          
					          
  </body>
</html>
